package top.kaoshanji.p2ch06b;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import top.kaoshanji.p2ch06b.support.MyObject;

import java.beans.Expression;

/**
 * 代码清单 p2ch06b-06：Expression类的使用示例
 * author kaoshanji
 * ^_^
 * create time 2025/1/19 16:16
 */
public class ExpressionExample01 {

    private static final Logger logger = LogManager.getLogger(ExpressionExample01.class);

    public static void main(String[] args) throws Exception {
        logger.info("...代码清单 p2ch06b-06：Expression类的使用示例...");

        // 对象、方法名、参数
        Expression expr = new Expression(new MyObject(), "greet", new Object[]{"alex1"});
        // 执行、获得结果
        expr.execute();
        Object result = expr.getValue();
        logger.info("...result:{}...", result);

    }

}
